﻿<UserControl x:Class="BallOnTiltablePlate.JanRapp.Controls.DoubleBox"
             x:ClassModifier="internal"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:BallOnTiltablePlate.JanRapp.Controls"
             mc:Ignorable="d" Height="24" 
             FocusManager.IsFocusScope="True">
    <UserControl.Resources>
        <RoutedCommand x:Key="IncreaseValue">
        </RoutedCommand>
        <RoutedCommand x:Key="DecreaseValue">
        </RoutedCommand>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding Command="{StaticResource IncreaseValue}" Executed="IncreaseValueCmdExecuted"/>
        <CommandBinding Command="{StaticResource DecreaseValue}" Executed="DecreaseValueCmdExecuted"/>
    </UserControl.CommandBindings>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="0.5*"/>
            <RowDefinition Height="0.5*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="44"/>
            <ColumnDefinition Width="18"/>
        </Grid.ColumnDefinitions>
        <Label x:Name="lbl" HorizontalAlignment="Left" Target="{Binding ElementName=txtBox}" Grid.RowSpan="2" Padding="3" Content="{Binding Text, RelativeSource={RelativeSource AncestorType=local:DoubleBox}}"/>
        <TextBox x:Name="txtBox"  TextChanged="txtBox_TextChanged" LostKeyboardFocus="txtBox_LostKeyboardFocus" Margin="0" Grid.RowSpan="2" Grid.Column="1"  GotKeyboardFocus="txtBox_GotKeyboardFocus"/>
        <RepeatButton Focusable="False" x:Name="UpBtn" Command="{StaticResource IncreaseValue}" d:LayoutOverrides="Width" Grid.Column="2" BorderBrush="{x:Null}">
            <Path Data="M0,10 L30,10 15,0 z" Fill="#FF222A43" Width="11.917" Height="6" Stretch="Fill"/>
        </RepeatButton>
        <RepeatButton Focusable="False" x:Name="DownBtn" Command="{StaticResource DecreaseValue}" Margin="0" d:LayoutOverrides="Width" Grid.Column="2" Grid.Row="1" Padding="0,1" RenderTransformOrigin="0.5,0.5" BorderBrush="{x:Null}">
            <Path Data="M0,0 L30,0 15,10 z" Fill="#FF222A43" Height="6" Stretch="Fill" Width="12.083"/>
        </RepeatButton>
    </Grid>
</UserControl>
